package com.example.demo.commons.Utils;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

//存储验证码
public class CodesUtils {
    //    key 用户名  value  验证码
    private static Map<String, Integer> codes = new ConcurrentHashMap<>();

    //返入
    public static void putCode(String username, Integer code) {
        codes.put(username, code);
    }
//获取
    public static Integer getCode(String username) {
        return codes.get(username);
    }
    //删除
    public static void remove(String username) {
        codes.remove(username);
    }
}
